//
//  RanklisArray.m
//  TianXiaShi
//
//  Created by CongCong on 15-7-14.
//  Copyright (c) 2015年 CongCong. All rights reserved.
//

#import "RanklisArray.h"
#import "AFNetworking.h"

@implementation RanklisArray
+ (id)sharedRank
{
    static dispatch_once_t once = 0;
    static id _sharedObject = nil;
    dispatch_once(&once, ^{
        _sharedObject = [[self alloc] init];
        
    });
    return _sharedObject;
}
- (id)init
{
    if (self == [super init]) {
        AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
        manager.responseSerializer = [AFHTTPResponseSerializer serializer];
        [manager GET:@"http://vcsp.ifeng.com/vcsp/appData/recommend.do?useType=androidPhone&channelId=rankList&pageSize=10&adapterNo=6.8.0" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
            NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
            self.model = [[LCHotRankListModel alloc]initWithDictionary:dict error:nil];
            
        }
             failure:^(AFHTTPRequestOperation *operation, NSError *error) {
                 NSLog(@"下载失败");
             }];
    }
    return self;
}
- (LCHotRankListModel*)getModel
{
    return self.model;
}
@end
